package it.antonio.ilpizze.assertion.concrete;

import java.io.File;

import it.antonio.ilpizze.assertion.Assertion;
import it.antonio.ilpizze.assertion.Condition;

public class FileAssertion extends Assertion<File> {
        
        public FileAssertion(File instance){
                super(instance);
        }
        
        @Override
        public FileAssertion as(String description) {
                description(description);
                return this;
        }

        @Override
        public FileAssertion doesNotSatisfy(Condition condition) {
                assertNotSatisfy(condition);
                return this;
        }

        @Override
        public FileAssertion isEqualTo(File expected) {
                assertEqual(expected);
                return this;
        }

        @Override
        public FileAssertion isNotEqualTo(File other) {
                assertNotEqual(other);
                return this;
        }

        @Override
        public FileAssertion isNotNull() {
                assertNotNull();
                return this;
        }

        @Override
        public FileAssertion isNotSameAs(File other) {
                assertIsNotSameAs(other);
                return null;
        }

        @Override
        public FileAssertion isSameAs(File expected) {
                assertIsSameAs(expected);
                return null;
        }

        @Override
        public FileAssertion satisfies(Condition condition) {
                assertSatisfy(condition);
                return this;
        }
        
        public FileAssertion exists() {
                assertNotNull();
                if(!instance.exists()){
                        fail("the file: " + instance + " does not exist");
                }
                return this;
        }
        

}